package com.jz.netthings.application.providerCollection.controller;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.jz.netthings.application.providerCollection.bean.Poweroff;
import com.jz.netthings.application.providerCollection.bean.Precharge;
import com.jz.netthings.application.providerCollection.bean.ProvisionConsumable;
import com.jz.netthings.application.providerCollection.service.PrechargeService;
import com.jz.netthings.application.providerCollection.service.ProvisionConsumableService;
import com.jz.netthings.exception.AdscmSystemException;
import com.jz.netthings.support.SimpleCoreResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 采浆记录-预充 前端控制器
 * </p>
 *
 * @author zyl
 * @since 2019-03-22
 */
@RestController
@RequestMapping("/adscm/application/providerCollection/select/precharge")
public class PrechargeController {
    @Autowired
    PrechargeService prechargeService;
    @RequestMapping("/selectPrecharge")
    public SimpleCoreResponse selectNoDealProviderCollection( String mlogId , HttpServletRequest request) throws AdscmSystemException, IOException {
        Wrapper<Precharge> wrapper =new EntityWrapper<>();
        wrapper.like("mlogId", mlogId);
        List<Precharge> precharges = prechargeService.selectList(wrapper);
        Precharge precharge =new Precharge();
        if (precharges!=null && precharges.size()>0){
            precharge=precharges.get(0);
        }

        return new SimpleCoreResponse("200","查询成功" ,precharge);
    }
}

